﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InsXiaoQiuCount : MonoBehaviour
{
    public GameObject[] objs;
    public float[] insInternal;
    public ObjArgs[] mObjArgs;
    public float[] timeNow;
    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        for(int i=0;i< objs.Length;++i)
        {
            if (Time.time > timeNow[i])
            {
                int intId = Random.Range(0, mObjArgs.Length);
                timeNow[i] = Time.time + insInternal[intId];
                int objId = Random.Range(0, objs.Length);
                GameObject tempObj = Instantiate(objs[objId], mObjArgs[intId].pos.position, Quaternion.identity) as GameObject;
                tempObj.transform.GetComponent<Renderer>().material.color = mObjArgs[intId].colorTemp;
                tempObj.GetComponent<DesIt>().SetLiveTime(mObjArgs[intId].percent);
            }

        }
       
    }
}
